package com.smz.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smz.dao.SupplierDAO;
import com.smz.entity.Supplier;
import com.smz.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SupplierServiceImpl extends ServiceImpl<SupplierDAO, Supplier> implements SupplierService {
    @Autowired
    SupplierDAO supplierDAO;
    @Override
    public IPage<Supplier> findSupplierPage(int current, int size) {
        IPage iPage = supplierDAO.selectSupplierPage(new Page(current, size));
        return iPage;
    }


    @Override
    public IPage<Supplier> findSupplierLikePage(int current, int size, String address, String name) {
        return supplierDAO.selectSupplierLikePage(new Page(current, size),"%"+address+"%","%"+name+"%");
    }

    @Override
    public String addSupplier(Supplier supplier) {
        supplierDAO.insertSupplier(supplier);
        return "ok";
    }
}
